import request from '@/utils/request'

/**
 *
 * @param {data} 入参
 * @abstract 管理员增删改查接口
 */
export function addProductAjax(data) {
    return request({
        url: '/admin/rddGoods',
        method: 'post',
        headers: { "Content-Type": "multipart/form-data" },
        data: data
    })
}

export function updateProductAjax(data) {
    return request({
        url: '/admin/rddGoods/' + data.id,
        method: 'put',
        data: { ...data }
    })
}

export function getProductAjax(data) {
    return request({
        url: '/admin/rddGoods/' + data.id,
        method: 'get',
        params: { ...data }
    })
}

export function fetchProductsAjax(data) {
    return request({
        url: '/admin/rddGoods',
        method: 'get',
        params: { ...data }
    })
}

export function delProductAjax(data) {
    return request({
        url: '/admin/rddGoods/' + data.id,
        method: 'delete'
    })
}

export function uploadImg(data) {
    return request({
        url: '/admin/img/' + data.id,
        method: 'delete'
    })
}

export function fetchOrderAjax(data) {
    return request({
        url: '/admin/rddOrder',
        method: 'get',
        params: { ...data }
    })
}

export function orderDetails(data) {
    return request({
        url: '/admin/rddOrder/' + data.id,
        method: 'get',
        params: { ...data }
    })
}
